Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use updated barcode to patron_id query #33

Merged
merged 2 commits into from
Nov 13, 2024
Merged

Use updated barcode to patron_id query #33

merged 2 commits into from
Nov 13, 2024

Conversation

aaronfriedman6
Copy link
Contributor

No description provided.

Comment on lines -123 to -148
logger.info(f"Setting Sierra query timeout to {sierra_timeout} minutes")
sierra_client.execute_query(f"SET statement_timeout='{sierra_timeout}min';")
logger.info("Querying Sierra for patron information by barcode")

initial_log_level = logging.getLogger("postgresql_client").getEffectiveLevel()
logging.getLogger("postgresql_client").setLevel(logging.CRITICAL)
finished = False
num_attempts = 1
while not finished:
try:
sierra_raw_data = sierra_client.execute_query(sierra_query)
finished = True
except PostgreSQLClientError as e:
if num_attempts < max_sierra_attempts:
logger.info("Query failed -- trying again")
num_attempts += 1
else:
logger.error(
f"Error executing Sierra query {sierra_query}:" "\n{e}"
)
sierra_client.close_connection()
s3_client.close()
kinesis_client.close()
raise e from None
logging.getLogger("postgresql_client").setLevel(initial_log_level)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for my own understanding -- you're getting rid of this because of this story right? Just want to double check

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it's part of this one. The reason we were originally retrying is because the query would time out and fail a bunch. With this new query we don't expect that to happen.

@@ -6,13 +6,11 @@ PLAINTEXT_VARIABLES:
SIERRA_DB_PORT: 1032
SIERRA_DB_NAME: iii
REDSHIFT_DB_NAME: production
ENVISIONWARE_BATCH_SIZE: 500
ENVISIONWARE_BATCH_SIZE: 10000

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last question -- any specific reason this was upped? Or is it just to improve performance?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that the query is more efficient we can send more barcodes at once!

@aaronfriedman6 aaronfriedman6 merged commit 4bea113 into main Nov 13, 2024
2 checks passed
@aaronfriedman6 aaronfriedman6 deleted the new-query branch November 13, 2024 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants